<!-- 雨量与气温监测预警的详细页面 -->
<!-- 初步完结2024-10-8 -->
<template>
    <div class="container">
        <div style="display: flex; align-items: center; padding: 10px; color: #fff;">
            <span style="margin-right: 20px; font-weight: bold;">天气实况监测</span>
            <span style="margin-right: 20px;">|</span>
            <span style="display: flex; align-items: center;">
                <span>{{ $route.query.title }}</span>
            </span>
            <span style="margin:0 20px;">|</span>
            <span style="display: flex; align-items: center;">
                <span style="font-size: 14px;">单站查询</span>
            </span>
        </div>


        <div class="content">
            <div class="title">
                <span>单站查询</span>
            </div>
            <div class="table1">
                <el-table :data="tableData1" ref="table" style="width: 100%;height:100%"
                    :header-cell-style="headerCellStyle" :cell-style="cellStyle" :row-style="rowStyle"
                    max-height="600px">

                    <el-table-column prop="county" label="所在县" align="center">
                    </el-table-column>
                    <el-table-column prop="sid" label="区站号" align="center">
                    </el-table-column>
                    <el-table-column prop="sname" label="站名" align="center">
                    </el-table-column>
                    <el-table-column prop="elementNum" label="要素个数" align="center">
                    </el-table-column>
                    <el-table-column prop="latitude" label="海拔" align="center">
                    </el-table-column>
                    <el-table-column prop="lon" label="经度" align="center">
                    </el-table-column>
                    <el-table-column prop="lat" label="纬度" align="center">
                    </el-table-column>

                </el-table>
            </div>


            <div class="explain">
                <span style="color: white">单位：雨量(0.1mm)、温度(0.1度)、风向(度)、风速(0.1m/s)、湿度(0.1%)、气压(0.1hpa)、采集器电压(0.1v)</span>
            </div>

            <div class=" table2">
                <el-table :data="tableData2" ref="table" style="width: 100%;height:100%"
                    :header-cell-style="headerCellStyle" :cell-style="cellStyle" :row-style="rowStyle"
                    max-height="600px">
                    <el-table-column prop="tt" label="观测时间" align="center">
                    </el-table-column>
                    <el-table-column prop="ba" label="雨量" align="center">
                    </el-table-column>
                    <el-table-column prop="bd" label="湿度" align="center" v-if="elementNum >= 5">
                    </el-table-column>
                    <el-table-column prop="bc" label="温度" align="center" v-if="elementNum >= 2">
                    </el-table-column>
                    <el-table-column prop="bp" label="气压" align="center" v-if="elementNum >= 6">
                    </el-table-column>
                    <el-table-column prop="aa" label="瞬时风向" align="center" v-if="elementNum >= 4">
                    </el-table-column>
                    <el-table-column prop="ab" label="瞬时风速" align="center" v-if="elementNum >= 4">
                    </el-table-column>
                    <el-table-column prop="afmx" label="最大风速" align="center" v-if="elementNum >= 4">
                    </el-table-column>
                    <el-table-column prop="afmxt" label="最大风速时间" align="center" v-if="elementNum >= 4">
                    </el-table-column>
                    <el-table-column prop="itt" label="入库时间" align="center">
                    </el-table-column>

                </el-table>
            </div>
        </div>

    </div>
</template>

<script>
import { reqStationDetail } from '@/api/monitor/index.js'
export default {
    data() {
        return {
            tableData1: [],
            tableData2: []
        }
    },
    mounted() {
        this.getData()
    },
    methods: {
        async getData() {
            let res = await reqStationDetail(this.$route.query.wsId)
            this.tableData1 = res.data.stationInfoList
            this.elementNum = res.data.elementNum
            this.tableData2 = res.data.details
        },
        // 表格样式
        headerCellStyle() {
            return {
                background: '#0c2340',
                color: '#fff',
            };
        },
        cellStyle() {
            return {
                background: '#05152e',
                color: '#fff',
            };
        },
        rowStyle() {
            return {
                height: '30px',
            };
        },
    }
}
</script>

<style scoped lang="scss">
// 滚动条样式
::v-deep .el-table__body-wrapper {

    // 整个滚动条
    &::-webkit-scrollbar {
        width: 10px; // 纵向滚动条的宽度
        background: rgba(213, 215, 220, 0.3);

    }

    // 滚动条轨道
    &::-webkit-scrollbar-track {
        border: 5px solid white;
    }


}

// 滚动条的滑块
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
    background-color: #0c2340;
    border-radius: 2px;
}

// --------------------隐藏table gutter列和内容区右侧的空白 start
::v-deep .el-table th.gutter {
    display: none;
    width: 0
}

::v-deep .el-table colgroup col[name='gutter'] {
    display: none;
    width: 0;
}

// 这个样式不加的话内容哪里会缺一点，估计是因为滚动条哪里缺的没有补上
::v-deep .el-table__body {
    width: 100% !important;
}

// --------------------隐藏table gutter列和内容区右侧的空白 end把以上改成css

.container {
    width: 100%;
    height: 100%;
    box-sizing: border-box;

    .content {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;

        .title {
            width: 100%;
            height: 30px;
            display: grid;
            place-items: center;

            span {
                color: white;
                font-size: 25px;
                font-weight: bold;
            }
        }

        .table1 {
            width: 95%;

            margin: 20px 0;
        }

        .explain {
            width: 100%;
            margin: 20px 0;
            display: grid;
            place-items: center;
        }

        .table2 {
            width: 95%;
            margin: 20px 0;

        }
    }


}
</style>